package com.leyou.page.web;

import com.leyou.page.service.impl.PageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;

/**
 * @ClassName PageController
 * @Date 2019/2/21 10:39
 */
@Controller
public class PageController {

    @Autowired
    private PageServiceImpl pageService;
    
    @GetMapping("item/{id}.html")
    public String toItemPage(@PathVariable("id")Long id, Model model) {
        Map<String, Object> attributies =pageService.loadModel(id);
        model.addAllAttributes(attributies);
        return "item";
    }
    
}
